package com.kotlin.tsw.baselibrary.rx

import com.kotlin.tsw.baselibrary.persenter.view.BaseView
import rx.Subscriber
import java.net.SocketTimeoutException

open class BaseSubScriber<T>(val progressView:BaseView):Subscriber<T>() {
    override fun onNext(t: T) {
    }

    override fun onCompleted() {
        progressView.hideLoading()
    }

    override fun onError(e: Throwable) {
        progressView.hideLoading()
        if (e is BaseException) {
            progressView.onErorr(e.msg)
        }else if(e is SocketTimeoutException){
            progressView.onErorr("网络超时")
        }
    }
}